
// 体验 toString 函数的多种形态
// Boolean 、Array 、Date 的原型上都重写了 toString 函数

function show( x ){
    // 究竟调用哪个toString函数取决于引用变量x指向哪个实例
    let s = x.toString() ; 
    console.log( s , typeof( s ) );
}

let first = new Boolean( true ); // Boolean对象重写了toString
console.log( first , typeof( first ) );

show( first ); // true

let second = new Array(10); // Array对象重写了toString
console.log( second , typeof( second ) );

show( second );

let third = new Date(); // Date对象重写了toString
console.log( third , typeof( third ) );

show( third );